﻿using System;
using System.Runtime.Serialization;
using NCMIS.ObjectModel.MetaData;

namespace NCMIS.Produce
{
    /// <summary>
    /// Speicifies the exception types that a repository may return in response to a CMIS service method call.
    /// </summary>
    [DataContract(Namespace = CmisNs.Cmism)]
    public enum ServiceExceptionType
    {
        /// <summary>
        /// The operation violates a Repository- or Object-level constraint defined in the CMIS domain model.
        /// </summary>
        [EnumMember(Value = "constraint")]
        Constraint,

        /// <summary>
        /// The repository is not able to store the object that the user is creating/updating due to a name constraint violation.
        /// </summary>
        [EnumMember(Value = "nameConstraintViolation")]
        NameConstraintViolation,

        /// <summary>
        /// The operation attempts to set the content stream for a Document that already has a content stream without
        /// explicitly specifying the “overwriteFlag” parameter.
        /// </summary>
        [EnumMember(Value = "contentAlreadyExists")]
        ContentAlreadyExists,

        /// <summary>
        /// The property filter or rendition filter input to the operation is not valid.
        /// </summary>
        [EnumMember(Value = "filterNotValid")]
        FilterNotValid,

        /// <summary>
        /// One or more of the input parameters to the service method is missing or invalid.
        /// </summary>
        [EnumMember(Value = "invalidArgument")]
        InvalidArgument,

        /// <summary>
        /// The service method invoked requires an optional capability not supported by the repository.
        /// </summary>
        [EnumMember(Value = "notSupported")]
        NotSupported,

        /// <summary>
        /// The service call has specified an object that does not exist in the Repository
        /// </summary>
        [EnumMember(Value = "objectNotFound")]
        ObjectNotFound,

        /// <summary>
        /// The caller of the service method does not have sufficient permissions to perform the operation.
        /// </summary>
        [EnumMember(Value = "permissionDenied")]
        PermissionDenied,

        /// <summary>
        /// Any other cause not expressible by another CMIS exception.
        /// </summary>
        [EnumMember(Value = "runtime")]
        Runtime,

        /// <summary>
        /// The repository is not able to store the object that the user is creating/updating due to an internal storage problem.
        /// </summary>
        [EnumMember(Value = "storage")]
        Storage,

        /// <summary>
        /// The operation is attempting to get or set a contentStream for a Document whose Object-type specifies that a content
        /// stream is not allowed for Document's of that type.
        /// </summary>
        [EnumMember(Value = "streamNotSupported")]
        StreamNotSupported,

        /// <summary>
        /// The operation is attempting to update an object that is no longer current (as determined by the repository).
        /// </summary>
        [EnumMember(Value = "updateConflict")]
        UpdateConflict,

        /// <summary>
        /// The operation is attempting to perform an action on a non-current version of a Document that cannot be performed on
        /// a non-current version.
        /// </summary>
        [EnumMember(Value = "versioning")]
        Versioning,
    }
}
